class PlayController < ApplicationController
  before_filter :authorize
  
  def index
    @plays = Play.find(:all)
  end
  
  def show
    @play = Play.find(params[:id])
  end
  
  def new
    @play = Play.new
  end
  
  def edit
    @play = Play.find(params[:id])
  end
  
  def create
    @play = Play.new(params[:play])
    if @play.save
      flash[:notice] = "The play information saved successfully!"
      redirect_to :action => "index"
    else
      render :action => "new"
    end
  end
  
  def update
    @play = Play.find(params[:id])
    if @play.update_attributes(params[:play])
      flash[:notice] = "The play information updated successfully!"
      redirect_to :action => "index"
    else
      render :action => "edit"
    end
  end
  
  def destroy
    @play = Play.find(params[:id])
    @play.destroy
    flash[:notice] = "The play information destroied successfully!"
    redirect_to :action => "index"
  end
end